package Day31;


public class HomeWork1 {
    public static void main(String[] args) {
       AA a = new AA();
       a.testWork(new Calculate(){
           @Override
           public double work(double n1, double n2) {
               return n1 + n2;
           }
       },10,10);
       a.testWork(new Calculate(){
           @Override
           public double work(double n1, double n2) {
               return n1 * n2;
           }
       },10,10);

    }
}
interface Calculate{
    public double work(double n1, double n2);
}

class AA{
    public void testWork(Calculate c1, double n1,double n2){
        double result = c1.work(n1,n2);
        System.out.println("计算的最后结果是" + result);
    }
}